<!--选择评价标准-->
<template>
  <div>
    <el-dialog title="选择评价标准" :visible.sync="dialogVisible" :close-on-click-modal="false" width="70%">
      <div class="table-container table-css">
        <el-table ref="multipleTable" :data="tableData" border style="width: 100%" :header-cell-class-name="cellClass" @selection-change="handleSelectionChange"
         class="table-data" :header-cell-style="{background:'#edf2f9','border-color': '#c7d7eb'}">
            <el-table-column type="selection" align="center" width="100"></el-table-column>
            <el-table-column prop="total" label="标准体系名称" align="center" min-width="130">
              <template slot-scope="scope">{{scope.row.pjEvalguide.guidename}}</template>
            </el-table-column>
            <el-table-column label="采用的标准等级" align="center"  min-width="130">
              <template slot-scope="scope">{{scope.row.pjGuiderank.guiderankoption}}</template>
            </el-table-column>
        </el-table>
        <div class="button-group" slot="footer">
          <div class="" @click="save">保存</div>
          <div class="" @click="dialogVisible = false">取消</div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {bzList} from "@/api/lineData";
export default {
  data() {
    return {
      dialogVisible:false, 
      tableData: [],
      IDS:[],
    };
  },
  mounted(){
    this.initList();
    this.$nextTick(()=>{
      
    })
    
  },
  methods: {
    //初始化表格
    async initList(){
      let res = await bzList();
      if(res.code == 200){
        this.tableData = res.data;
      }
    },
    handleSelectionChange(row){
      if(row.length>1){
        this.$refs.multipleTable.clearSelection();
        this.$refs.multipleTable.toggleRowSelection(row.pop());
      }
      if(row.length != 0){
         this.IDS = row[row.length - 1];
     }
    },
    save(){
      if(JSON.stringify(this.IDS) !=='{}'){
        this.$emit('choseBZid',this.IDS);
        this.dialogVisible = false
      }else{
        this.$message.error('请选择标准！')
      }
    },
    cellClass(row){
        if (row.columnIndex === 0) {
            return 'noneSelectHeader'
        }
    },
  },
};
</script>
<style lang="less" scoped>
.table-css {
  margin:  30px 40px 0 40px;
 /deep/ .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  /deep/.el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  /deep/.el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }
 /deep/ .el-table__footer-wrapper td {
    padding: 0;
    height: 86px;
  }
  /deep/.el-table thead.is-group th.el-table__cell{
    border-color: #c7d7eb;
  }
 /deep/ .el-table--border th, .el-table__fixed-right-patch{
    border-color: #c7d7eb;
  }
}
</style>

<style lang="less" scoped>
@import "../../../../styles/commonCss.less";
/deep/.button-group{
  padding-bottom: 48px;
}
.width90{width: 90px;}
.el-table /deep/.noneSelectHeader .cell:before{
                content:"选择";
            }
            .el-table /deep/.noneSelectHeader .cell .el-checkbox{
  display: none;
}
</style>
